import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views'
import UserList from '@/views/users/list'
import UserForm from '@/views/users/form'
import RoleList from '@/views/roles/list'
import RoleForm from '@/views/roles/forms'
import Login from '@/views/common/login'

import Homes from '@/view/Home'

Vue.use(Router)

let routes =[
  {
    path: '/',
    component: Homes,
    name: '首页',
    iconCls: 'el-icon-message',//图标样式class
  },
  {
    path: '/Home',
    component: Home,
    name: '用户管理',
    iconCls: 'el-icon-message',//图标样式class
    children: [
      { path: '/userList', component: UserList, name: '用户列表' },
      { path: '/userForm', component: UserForm, name: '用户表单' },
    ]
  },
  {
    path: '/',
    component: Home,
    name: '角色管理',
    iconCls: 'el-icon-message',//图标样式class
    children: [
      { path: '/roleList', component: RoleList, name: '角色列表' },
      { path: '/roleForm', component: RoleForm, name: '角色表单' },
    ]
  },
  {
    path: '/',
    component: Home,
    name: '登录测试',
    leaf:true,//只有一个节点
    iconCls: 'el-icon-setting',//图标样式class
    children: [
      { path: '/login', component: Login, name: '登录' }
    ]
  }];

function addRoutes(importRoutes){
  for(let i=0;i<importRoutes.length;i++){
    routes.push(importRoutes[i]);
  }
}

export default new Router({
  routes: routes
})
